using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;

namespace Colman.Rpg.Messaging
{
    /// <summary>
    /// Represents a notification from the server about a message in the chat room.
    /// </summary>
    [Serializable]
    public class ChatMessageResponse : ResponseMessage
    {
        /// <summary>
        /// Creates a new instance of <see cref="ChatMessageResponse" />.
        /// </summary>
        /// <param name="messageBody">The text body of the message.</param>
        /// <param name="messageColor">The color of the message.</param>
        /// <param name="sender">The name of the message's sender.</param>
        /// <param name="destinations">The users the response is destined to.</param>
        public ChatMessageResponse(string messageBody, Color messageColor, string sender, List<Player> destinations)
            : base(destinations)
        {
            this.messageColor = messageColor;
            this.messageBody = messageBody;
            this.sender = sender;
            this.isPrivate = false;
        }

        /// <summary>
        /// Creates a new instance of <see cref="ChatMessageResponse" />.
        /// </summary>
        /// <param name="messageBody">The text body of the message.</param>
        /// <param name="messageColor">The color of the message.</param>
        /// <param name="sender">The name of the message's sender.</param>
        /// <param name="destinations">The users the response is destined to.</param>
        public ChatMessageResponse(string messageBody, Color messageColor, string sender, params Player[] destinations)
            : base(destinations)
        {
            this.messageColor = messageColor;
            this.messageBody = messageBody;
            this.sender = sender;
            this.isPrivate = true;
        }

        /// <summary>
        /// Creates a new instance of <see cref="ChatMessageResponse" />.
        /// </summary>
        /// <param name="messageBody">The text body of the message.</param>
        /// <param name="messageColor">The color of the message.</param>
        /// <param name="sender">The name of the message's sender.</param>
        public ChatMessageResponse(string messageBody, Color messageColor, string sender)
            : base(ResponseDestination.Everyone)
        {
            this.messageColor = messageColor;
            this.messageBody = messageBody;
            this.sender = sender;
            this.isPrivate = false;
        }

        #region Color MessageColor { get; } (messageColor)
        private Color messageColor;

        /// <summary>
        /// Gets the color of the message.
        /// </summary>
        public Color MessageColor
        {
            [System.Diagnostics.DebuggerStepThrough]
            get
            {
                return this.messageColor;
            }
        }
        #endregion

        #region string MessageBody { get; } (messageBody)
        private string messageBody;

        /// <summary>
        /// Gets the text body of the message.
        /// </summary>
        public string MessageBody
        {
            [System.Diagnostics.DebuggerStepThrough]
            get
            {
                return this.messageBody;
            }
        }
        #endregion

        #region string Sender { get; } (sender)
        private string sender;

        /// <summary>
        /// Gets the name of the message's sender.
        /// </summary>
        public string Sender
        {
            [System.Diagnostics.DebuggerStepThrough]
            get
            {
                return this.sender;
            }
        }
        #endregion

        #region bool IsPrivate { get; } (isPrivate)
        private bool isPrivate;

        /// <summary>
        /// Gets whether the message is private.
        /// </summary>
        public bool IsPrivate
        {
            [System.Diagnostics.DebuggerStepThrough]
            get
            {
                return this.isPrivate;
            }
        }
        #endregion
    }
}
